<template>
  <div class="config-layout">
    <div class="page-header">
      <div class="header-left">
        <h2>配置管理</h2>
      </div>
    </div>

    <!-- 左侧导航菜单 -->
    <div class="config-container">
      <div class="config-sidebar">
        <el-menu
          :default-active="activeMenu"
          class="config-menu"
          router
        >
          <el-menu-item index="/config/brands">
            <el-icon><Goods /></el-icon>
            <span>品牌管理</span>
          </el-menu-item>
          <el-menu-item index="/config/product-names">
            <el-icon><List /></el-icon>
            <span>品名管理</span>
          </el-menu-item>
          <el-menu-item index="/config/units">
            <el-icon><Collection /></el-icon>
            <span>单位管理</span>
          </el-menu-item>
          <el-menu-item index="/config/unit-conversions">
            <el-icon><Connection /></el-icon>
            <span>单位换算管理</span>
          </el-menu-item>
          <el-menu-item index="/config/marketing-words">
            <el-icon><ChatLineRound /></el-icon>
            <span>营销词管理</span>
          </el-menu-item>
          <el-menu-item index="/config/system">
            <el-icon><Setting /></el-icon>
            <span>系统配置</span>
          </el-menu-item>
        </el-menu>
      </div>
      
      <!-- 右侧内容区域 -->
      <div class="config-content">
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, computed } from 'vue'
import { useRoute } from 'vue-router'
import {
  Goods,
  List,
  Collection,
  ChatLineRound,
  Setting,
  Connection
} from '@element-plus/icons-vue'

const route = useRoute()

// 计算当前激活的菜单项
const activeMenu = computed(() => route.path)
</script>

<style scoped>
.config-layout {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.page-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e4e7ed;
}

.page-header h2 {
  margin: 0;
  font-size: 20px;
  color: #303133;
}

.config-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.config-sidebar {
  width: 200px;
  border-right: 1px solid #e4e7ed;
  background-color: #fff;
}

.config-menu {
  border-right: none;
}

.config-content {
  flex: 1;
  padding: 20px;
  overflow: auto;
}

.el-menu-item [class^="el-icon"] {
  margin-right: 8px;
  width: 24px;
  text-align: center;
  font-size: 18px;
}
</style> 